#include<iostream>
#include<cstring>
#include <string.h>
using namespace std;

class myString{
	
private:

    char *pstr;   
    int size;     
    
public:

    myString(char *pn = NULL);  
    myString(const myString &rStr);  
    int getLen();  
    void set(const char *pn); 
    void print() const;
    char get(int i) const;   
    void toUpper();   
	bool strcompare(const myString &s);   
    ~myString();
};

myString::myString(char *pn){
	if(pn){
		pstr = new char[strlen(pn) + 1];
		strcpy(pstr, pn);
	}else{
		pstr = NULL;
	}

};  

myString::myString(const myString &that){
	char *p = that.pstr;
	if(p){
		pstr = new char[strlen(p) + 1];
		strcpy(pstr, p);
	}else{
        pstr = NULL;
    }

}; 

int myString::getLen() {
    if(pstr)
	    return strlen(pstr);
    return 0;
};

void myString::print( ) const {
	if(pstr)
		cout << pstr << " With " << strlen(pstr) << " Characters\n";
	else
	 	cout << "Empty String\n";
};

char myString::get(int i) const {
	char c = '\0';
	if(pstr && i >= 0 && i < strlen(pstr)){
		c = pstr[i];
	}
	return c;
}; 

void myString::toUpper( ){
    if(!pstr){
        return;
    }

	for(int i = 0; i < strlen(pstr); ++i){
		if(pstr[i] >= 'a' && pstr[i] <= 'z'){
			pstr[i] += 'A' - 'a';
		}
	}
};

bool myString::strcompare(const myString &that){
    if(pstr && that.pstr){
	    return !strcmp(pstr, that.pstr);
    }
    return (pstr == NULL) == (that.pstr == NULL);
};

void myString::set(const char *pn){
    if(pn){
        char *prev = pstr;
	    pstr = new char[strlen(pn)+1];
	    strcpy(pstr, pn);
        delete[] prev;
    }
};

myString::~myString(){
	delete[] pstr;		
}

void solve() {

	/*
     *  Write You Test Code Here.
    */

}

int main(){

	solve();

	return 0;
}
